package com.ibeeking.found.upms.b.rest.controller.v1.feign;

import com.ibeeking.found.upms.b.rest.service.IOpenUserService;
import com.ibeeking.found.common.db.annotation.IgnoreDS;
import com.ibeeking.found.common.entity.LoginOpenUserDTO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName OpenUserController控制器
 * @Description open
 * @Author ibeeking
 * @Date 2020-12-02 15:29
 **/
@RestController
@RequestMapping("/b/openuser/feign/v1")
public class OpenUserFeignController {

    @Resource
    private IOpenUserService openUserServiceImpl;

    /**
     * 根据appId查询开放用户信息
     *
     * @param appId
     * @return
     */
    @IgnoreDS
    @PostMapping(value = "/queryLoginUser/{appId}")
    public LoginOpenUserDTO queryLoginUser(@PathVariable("appId") String appId) {
        return openUserServiceImpl.queryLoginUser(appId);
    }

    /**
     * 根据userId查询开放用户API权限
     *
     * @param userId
     * @return
     */
    @PostMapping(value = "/queryApis/{userId}")
    public List<String> queryApis(@PathVariable("userId") Long userId) {
        return openUserServiceImpl.queryApis(userId);
    }
}
